/*  1:   */ package org.jetbrains.lang.manifest.psi.impl;
/*  2:   */ 
/*  3:   */

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.lang.manifest.header.HeaderParserRepository;
import org.jetbrains.lang.manifest.psi.HeaderValuePart;
import org.jetbrains.lang.manifest.psi.ManifestToken;
import org.jetbrains.lang.manifest.psi.ManifestTokenType;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */ 
/* 15:   */ public class HeaderValuePartImpl
/* 16:   */   extends ASTWrapperPsiElement
/* 17:   */   implements HeaderValuePart
/* 18:   */ {
/* 19:   */   private final HeaderParserRepository e;
/* 20:   */   
/* 21:   */   public HeaderValuePartImpl(ASTNode paramASTNode)
/* 22:   */   {
/* 23:46 */     super(paramASTNode);
/* 24:47 */     this.e = ((HeaderParserRepository)ServiceManager.getService(HeaderParserRepository.class));
/* 25:   */   }
/* 26:   */   
/* 27:   */   @NotNull
/* 28:   */   public PsiReference[] getReferences()
/* 29:   */   {
/* 30:53 */     PsiReference[] tmp24_21 = (getUnwrappedText().isEmpty() ? PsiReference.EMPTY_ARRAY : this.e.getReferences(this));
/* 31:53 */     if (tmp24_21 == null) {
/* 32:53 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/lang/manifest/psi/impl/HeaderValuePartImpl", "getReferences" }));
/* 33:   */     }
/* 34:53 */     return tmp24_21;
/* 35:   */   }
/* 36:   */   
/* 37:   */   @NotNull
/* 38:   */   public String getUnwrappedText()
/* 39:   */   {
/* 40:59 */     StringBuilder localStringBuilder = new StringBuilder();
/* 41:61 */     for (PsiElement localPsiElement = getFirstChild(); localPsiElement != null; localPsiElement = localPsiElement.getNextSibling()) {
/* 42:62 */       if ((localPsiElement instanceof ManifestToken))
/* 43:   */       {
/* 44:63 */         ManifestTokenType localManifestTokenType = ((ManifestToken)localPsiElement).getTokenType();
/* 45:64 */         if ((localManifestTokenType == ManifestTokenType.NEWLINE) || (localManifestTokenType == ManifestTokenType.SIGNIFICANT_SPACE)) {}
/* 46:   */       }
/* 47:   */       else
/* 48:   */       {
/* 49:68 */         localStringBuilder.append(localPsiElement.getText());
/* 50:   */       }
/* 51:   */     }
/* 52:71 */     String tmp79_76 = localStringBuilder.toString().trim();
/* 53:71 */     if (tmp79_76 == null) {
/* 54:71 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/lang/manifest/psi/impl/HeaderValuePartImpl", "getUnwrappedText" }));
/* 55:   */     }
/* 56:71 */     return tmp79_76;
/* 57:   */   }
/* 58:   */   
/* 59:   */   @NotNull
/* 60:   */   public TextRange getHighlightingRange()
/* 61:   */   {
/* 62:77 */     PsiElement localPsiElement1 = getLastChild();
/* 63:78 */     if (((localPsiElement1 instanceof ManifestToken)) && (((ManifestToken)localPsiElement1).getTokenType() == ManifestTokenType.NEWLINE))
/* 64:   */     {
/* 65:79 */       int i = getTextOffset();
/* 66:80 */       PsiElement localPsiElement2 = localPsiElement1.getPrevSibling(); void 
/* 67:81 */         tmp64_61 = new TextRange(i, localPsiElement2 != null ? localPsiElement2.getTextRange().getEndOffset() : i);
/* 68:81 */       if (tmp64_61 == null) {
/* 69:81 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/lang/manifest/psi/impl/HeaderValuePartImpl", "getHighlightingRange" }));
/* 70:   */       }
/* 71:81 */       return tmp64_61;
/* 72:   */     }
/* 73:83 */     TextRange tmp103_100 = getTextRange();
/* 74:83 */     if (tmp103_100 == null) {
/* 75:83 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/lang/manifest/psi/impl/HeaderValuePartImpl", "getHighlightingRange" }));
/* 76:   */     }
/* 77:83 */     return tmp103_100;
/* 78:   */   }
/* 79:   */   
/* 80:   */   public String toString()
/* 81:   */   {
/* 82:88 */     return "HeaderValuePart";
/* 83:   */   }
/* 84:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.lang.manifest.psi.impl.HeaderValuePartImpl

 * JD-Core Version:    0.7.0.1

 */